﻿using System;

namespace RemoteGame
{
    public class Game: MarshalByRefObject
    {
        public int seed;

        public int Seed
        {
            get { return seed; }
            set { seed = value; }
        }

        public Game()
        {
            SetSeed();
            Initialized();
        }

        private void Initialized()
        {
            Console.WriteLine("Game created");
        }

        /// <summary>
        /// Used to reset seed instead of reseting remoted game object
        /// </summary>
        public void SetSeed()
        {
            Seed = (int)(DateTime.Now.Ticks % Int32.MaxValue);
        }

        // Returning null means the lease will never expire.
        public override object InitializeLifetimeService()
        {
            return null;
        }
    }
}
